rem
bbdoc: A simple expiration value component.
about: Typically used for bullets, particles, triggers, buttons, etc.
end rem
Type TExpirationComponent Extends TComponent {expose hidefields}

	Field _updatesLeft:Int
	

	Function Create:TExpirationComponent(life:Int) {hidden}
		Local e:TExpirationComponent = New TExpirationComponent
		e._updatesLeft = life
		Return e
	End Function
	
		
	Rem
	bbdoc: Returns the amount of updates before this component expires.
	endrem	
	Method GetUpdatesLeft:Int()
		Return _updatesLeft
	End Method
		
	
	Method Update() {hidden}
		_updatesLeft:-1
		If _updatesLeft < 0 Then _updatesLeft = 0
	End Method

	
	Rem
	bbdoc: Returns True if the component has expired.
	endrem	
	Method HasExpired:Int() {bool}
		Return _updatesLeft = 0
	End Method
		
End Type